package com.SMP.service.meet_room;

import com.SMP.dao.MeetPersonMapper;
import com.SMP.model.MeetPerson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service
public class MeetPersonService {
    @Autowired
    MeetPersonMapper meetPersonMapper;
    /**
     * @author TSY
    //  * @param 查询所有参会人员
     */
    public List<MeetPerson> getAllMeetPerson() {

        return meetPersonMapper.selectByExample(null);
    }
    /**
     * @author TSY
    // * @param 添加参会人员
     */
    public int addMeetPerson(MeetPerson meetPerson) {
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddss");//设置日期格式
        df.format(new Date());//一账户创建时间
        return meetPersonMapper.insertSelective(meetPerson);
    }
    /**
     * @author TSY
    // * @param 按照Id查询参会人员
     */
    public MeetPerson getMeetPerWithId(String personId) {
        MeetPerson  meetPerson = meetPersonMapper.selectByPersonid(personId);
        return meetPerson;
    }
    /**
     * @author TSY
    // * @param 按照姓名查询参会人员
     */
    public MeetPerson getMeetPerWithName(String personName) {

        MeetPerson  meetPerson = meetPersonMapper.selectByPersonName(personName);
        return meetPerson;
    }
    /**
     * @author TSY
    // * @param 修改参会人员
     */
    public int  updateMeetPerson(MeetPerson meetPerson) {

        return meetPersonMapper.updateByMeetPer(meetPerson);
    }
    /**
     * @author TSY
    // * @param 删除参会人员(假删）
     */
    public int  deleteMeetPerson(String personId) {
        MeetPerson  meetPerson =meetPersonMapper.selectByPersonid(personId);
        meetPerson.setStandby1("0");
        return meetPersonMapper.updateByMeetPer(meetPerson);
    }


}

